<?php



class Model_Hr_Discharge extends Zend_Db_Table_Abstract {

	protected $_name = 'staff_discharge_case';
	
	public function getDischarge( $idCase){
		
		$row = $this->fetchRow("`id_case` = ". $idCase);
		if(!$row) return false;
		return $row->toArray();		
		
		}
		
	public function addDischarge( $idStaff , $idManager , $dateApply , $typeDischarge , $reasonDischarge , $dateLastDay,$shop){
		
		$data = array(
			
         "id_staff" =>  $idStaff ,
         "id_manager" =>  $idManager ,
         "date_apply" =>  $dateApply ,
         "type_discharge" =>  $typeDischarge ,
         "reason_discharge" =>  $reasonDischarge ,
         "date_last_day" =>  $dateLastDay,
		 "shop_code" => $shop		 
	
			);
		$this->insert($data);
		
		}
		
	public function updateDischarge(  $idCase ,  $idStaff , $idManager , $dateApply , $typeDischarge , $reasonDischarge , $dateLastDay){
		$data = array(
			
         "id_staff" =>  $idStaff ,
         "id_manager" =>  $idManager ,
         "date_apply" =>  $dateApply ,
         "type_discharge" =>  $typeDischarge ,
         "reason_discharge" =>  $reasonDischarge ,
         "date_last_day" =>  $dateLastDay 
	
			);
			
		$this->update($data,"`id_case` = ". $idCase);
		}
		
	public function deleteDischarge( $idCase){
		
		$this->delete("`id_case` = ". $idCase);
		
		}	
	
	public function listAll(){
		
		$rows =$this->fetchAll("1","id_case DESC ");
		if(!$rows) return false;
		return $rows->toArray();			
		
		}	
}


?>